<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page import="com.kaishengit.dao.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>商品</title>
    <style type="text/css">
    	.btn{
  		  margin-left: 65px
  		}
    </style>
  </head>
  <body>
   	
   		<table  border="1">
   			<thead>
   				<tr>
   					<th>商品编号</th>
   					<th>名称</th>
   					<th>价格</th>
   					<th>是否上架</th>
   					<th colspan="2">操作</th>
   					 
   				</tr>
   			</thead>
   			<tbody id="a">
   				<c:if test="${empty list}">
					<tr>
						<td colspan="3">暂时没有数据:)</td>
				</tr>
				</c:if>
				<c:forEach items="${list }" var="pro">
				<tr id="${pro.id}">
					<td>${pro.id}</td>
					<td>${pro.proName}</td>
					<td>${pro.price}</td>
					<td>${pro.onsale}</td>
					<td>
						<a rel="${pro.id}" href ="javascript:void(0)" onclick="lookrow(event)" id="look">查看</a>
					<td><a rel="${pro.id}" href ="javascript:void(0)" name="delrow" id="del">删除</a>
					</td>
				</tr>
				</c:forEach>
   			</tbody>
   		</table>
   	
   		<center>添加商品名称</center>
   		
	   		商品编号:<input type="text" name="id" id="id"> 
	   		商品名称:<input type="text" name="proName" id="proName"><br>
	   		商品价格:<input type="text" name="price" id="price">
	   		是否上架:<input type="radio" name="onsale" value="true" >&nbsp;是
	   		   	  <input type="radio" name="onsale" value="false" >&nbsp;否<br>
	   		  		
	   	  <input type="button" value="添加" id="addrow" onclick="sendAjax()"/>
		  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	   	  <script type="text/javascript">
	   	 	$(document).ready(function(){
	   	 	$("#del").click(function(){
	   	 		$.get("pro.jspx",function(data){
  				$(data).each(function(){
  					alert(this.price);
  						});
  					});
	   	 		
	   	 		});
	   	 	
	   	});
  					
  				
  			
	   	  
	   	 
	   	
	   	  </script>
   	  
  </body>
</html>
